<template>
  <div class="change_email">
    <div class="email_content">
      <input type="email" placeholder="请输入邮箱" v-model="value" />
    </div>
    <button v-show="value == ''">提交</button>
    <button v-show="value != ''" @click="sendFrom" class="buttonActive">提交</button>
  </div>
</template>

<script>
  import {isEmail} from "../../../util/validate.js"
export default {
  data() {
    return{
      isControlSend: false,
      value: '',
    }
  },
  methods: {
    sendFrom() {
      if(isEmail(this.value)){
        this.$emit("controlSendFrom", this.value);
      }
      else{
        this.$message.error('你输入的邮箱格式不正确');
      }
    },
  },
};
</script>

<style lang="less" scoped>
.change_email {
  padding: 0 0px 5px;

  .email_content {
    border-bottom: 1px solid #ccc;
    height: 30px;
    display: felx;
    align-items: center;
    input {
      font-size: 16px;
    }
  }
  button {
    width: 100%;
    height: 40px;
    background-color: #ccc;
    margin-top: 20px;
    border-radius: 6px;
    cursor: no-drop;
    transition: all 0.2s;
  }
  .buttonActive{
    cursor: pointer;
    background-color: rgb(68, 162, 255);
    color: #fff;
  }
}
</style>
